package com.example.utils.excel;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.support.ExcelTypeEnum;
import org.apache.poi.ss.usermodel.Table;

import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class EasyExcelUtil {

    /**
     * 文件读取
     */
    private static final String file = "C:\\Users\\MSK\\Desktop\\test.xls";

    /**
     * 文件输出
     */
    private static final String writeFile = "C:\\Users\\MSK\\Desktop\\testWrite.xls";

    public static void main(String[] args) {
        List<List<String>> head = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            List<String> field = new ArrayList<>();
            field.add("表名");
            field.add("field" + i);
            head.add(field);
        }
        EasyExcel.write(writeFile).head(head).sheet("文件模板").doWrite(Collections.emptyList());
    }
}
